<!DOCTYPE html>
<html>
<head>
	<title>优惠券 </title>
	<meta charset="utf-8">	
	<style>
		html, body, div, span, iframe,
		h1, h2, h3, h4, h5, h6, p,
		a,
		em, img, q,
		small, strong, sub, sup,
		b, i,
		dl, dt, dd, ol, ul, li,
		form, label,
		table, tr, th, td
		{
			margin: 0;
			padding: 0;
			border: 0;
			vertical-align: baseline;
		}
		/* HTML5 display-role reset for older browsers */
		article, aside, details, figcaption, figure, 
		footer, header, hgroup, menu, nav, section {
			display: block;
		}
		body {
			line-height: 30px;
			text-align:center;
			font-size:14px;
			color: #333;
			font-family:微软雅黑;
		}
		ol, ul {
			list-style: none;
		}
		li{
			float:left;
			width:23%;
			height:25vw;
			margin:1%;
			text-align:left;
			min-width: 135px;
		}

		img{	
		border:0; 
		margin:0 auto; 
		padding:0; 
		width:100%; 
		height:160px;
		overflow: hidden;
		} 
		span{
			line-height:24px;
			white-space:nowrap;
			overflow:hidden;
			text-overflow:ellipsis;
		}
		blockquote, q {
			quotes: none;
		}
		blockquote:before, blockquote:after,
		q:before, q:after {
			content: '';
			content: none;
		}
		.left{
			float: left;
		}
		.right{
			float: right;
		}
	</style>
</head>

<body>
<div  style="width:1140px;height:370px;margin:0 auto;">
	<ul style="margin:0 auto;" id="gridtable">
	</ul>	
</div>

<script type="text/javascript" src="http://42.96.140.244:82/bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="bower_components/jquery.qrcode.min.js"></script>
<script type="text/javascript">
	var code = "<?=$_GET['city_code']?>";
	if(code != ""){
	$.ajax({
	    type: "GET",
	    url: "/city/"+code+"/coupon",
	    success: function( data){
	        if( !data.error ){       
	        console.log(data); 	
	        		var temp_count = data.result.data.length;
	        		
	        		if( temp_count > 0 ){ 
	        			for( var i=0; i<temp_count; i++ ){
	        				var div = $("<div class='qrcode' style='width:110px;height:110px;margin:5px;float:left;background-color:#fff;'/>");
	        				data.result.data[i].qrCode = "http://www.chinalove99.net:82/coupon/"+data.result.data[i].id+"/get";
	        				div.qrcode({height:100,width:100,text: data.result.data[i].qrCode});
	        				var li = $("<li />");
	        				var temp_data = data.result.data[i];
		        			var temp_tr = 	'<img src="'+temp_data['img_dir']+'">';

							var temp_tr2=	'<div style="width:140px;height:110px;overflow:hidden;">\
														<span style="font-size:16px;"><b>'+temp_data['subject']+'</b></span></br>\
														<span style="font-size:16px;">'+temp_data['seller_name']+'</span></br>\
														<span>起始：'+temp_data['start_time']+'</span>\</br>\
														<span>结束：'+temp_data['end_time']+'</span>\
												</div>';	
							li.append(temp_tr);	
							li.append(div);	
							li.append(temp_tr2);
							$("#gridtable").append(li);
						}
	        		}
	        }else{
	            alert(data.message);
	        }
	    }
	});
}
</script>
</body>
</html>

